#include <stdio.h>
#include <string.h>

#define SIZE 80

void swap(char s[], int left, int right)
{
        char tmp = s[left];
        s[left] = s[right];
        s[right] = tmp;
}

void inverse(char s[], int len, int left, int right)
{
        // terminator
        if (len <= 1)
                return;
        // process current logic
        swap(s, left, right);
        // drill down
        inverse(s, len - 2, left + 1, right - 1);
}

int main()
{
        char s[SIZE + 1];
        printf("Input a string:\n");
        gets(s);
        int s_len = strlen(s);
        inverse(s, s_len, 0, s_len - 1);
        printf("Inversed results:\n");
        printf("%s\n", s);
        return 0;
}